<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
	xmlns:jsf="http://xmlns.jcp.org/jsf" template="/WEB-INF/template.xhtml">

	<ui:define name="title">
        Edit Profile
    </ui:define>

	<ui:define name="description">
        Let you Edit Profiles
    </ui:define>

	<ui:define name="implementation">

		<h:form id="search">
			<p:growl id="growl" life="2000" />


			<p:tabView>
				<p:tab title="All Details">
					<p:dataTable var="profile" value="#{profileManagedBean.list}"
						id="profileTable" scrollable="true" scrollRows="8"
						scrollHeight="200"
						selection="#{profileManagedBean.selectedProfile}"
						rowKey="#{profile.idProfile}" selectionMode="single"
						emptyMessage="No profiless found with given criteria"
						filteredValue="#{profileManagedBean.filteredProfiles}">
						<p:ajax event="rowSelect"
							listener="#{profileManagedBean.onRowSelect}"
							update=":search:growl,:details" />
						<p:column filterBy="#{profile.idProfile}" headerText="Id"
							footerText="contains" filterMatchMode="contains">
							<h:outputText value="#{profile.idProfile}" />
						</p:column>

						<p:column filterBy="#{profile.firstname}" headerText="firstname"
							filterMatchMode="contains">
							<h:outputText value="#{profile.firstname}" />
						</p:column>
						<p:column filterBy="#{profile.lastname}" headerText="lastname"
							filterMatchMode="contains">
							<h:outputText value="#{profile.lastname}" />
						</p:column>
						<p:column filterBy="#{profile.occupation}" headerText="occupation"
							filterMatchMode="contains">
							<h:outputText value="#{profile.occupation}" />
						</p:column>

					</p:dataTable>
				</p:tab>
				<p:tab  title="Search By ID">
					<p:fieldset legend="Search" toggleable="true" toggleSpeed="500">
						<h:panelGrid columns="3">
							<p:outputLabel value="Profile Id :" for="id" />
							<p:inputText value="#{profileManagedBean.id}" required="true"
								id="id" placeholder="Enter Id" />
							<p:commandButton value="Search" id="ajax"
								update=":search:growl,:details"
								action="#{profileManagedBean.search}"
								style="margin-right:20px;float:right;"
								styleClass="ui-priority-primary" />
						</h:panelGrid>
					</p:fieldset>
				</p:tab>
			</p:tabView>
		</h:form>
		<p:spacer height="20" />

		<h:form id="details">
			<p:fieldset legend="Result" toggleable="true" toggleSpeed="500">
				<h:panelGrid columns="4" width="50%">
					<p:outputLabel value="First Name :" for="firstName" />
					<p:inputText value="#{profileManagedBean.firstname}" id="firstName"
						required="true" requiredMessage="First Name is required" />

					<p:outputLabel value="Last Name :" for="lastName" />
					<p:inputText value="#{profileManagedBean.lastname}" id="lastName"
						required="true" requiredMessage="Last Name is required" />
					<p:outputLabel value="Gender :" for="gender" />
					<p:selectOneRadio value="#{profileManagedBean.gender}" id="gender"
						required="true">
						<f:selectItem itemLabel="Male" itemValue="M"></f:selectItem>
						<f:selectItem itemLabel="Female" itemValue="F"></f:selectItem>
					</p:selectOneRadio>
					<p:outputLabel value="Date of Birth :" for="dob" />
					<p:calendar value="#{profileManagedBean.dob}" id="dob"
						pattern="dd/MM/yyyy HH:mm:ss"></p:calendar>

					<p:outputLabel value="Birth Place :" for="birthPlace" />
					<p:inputText value="#{profileManagedBean.birthplace}"
						id="birthPlace" />

					<p:outputLabel value="Height :" for="height" />

					<p:selectOneMenu id="height" value="#{profileManagedBean.height}">
						<f:selectItems value="#{profileManagedBean.heightList}"></f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="Complexion :" for="complexion" />
					<p:inputText value="#{profileManagedBean.complexion}"
						id="complexion" />
					<p:outputLabel value="Education Level :" for="educationlevel" />
					<p:selectOneMenu id="educationlevel"
						value="#{profileManagedBean.educationlevel}">
						<f:selectItems value="#{profileManagedBean.educationLevelList}"></f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="Education :" for="education" />
					<p:inputText value="#{profileManagedBean.education}" id="education" />
					<p:outputLabel value="Marital Status :" for="maritalStatus" />

					<p:selectOneMenu id="maritalStatus"
						value="#{profileManagedBean.maritalstatus}">
						<f:selectItems value="#{profileManagedBean.maritalstatusList}"></f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="Paternal Gotram :" for="paternalGotram" />
					<p:inputText value="#{profileManagedBean.paternalgotram}"
						id="paternalGotram" />
					<p:outputLabel value="Maternal Gotram :" for="maternalGotram" />
					<p:inputText value="#{profileManagedBean.maternalgotram}"
						id="maternalGotram" />
					<p:outputLabel value="Star :" for="star" />

					<p:selectOneMenu id="star" value="#{profileManagedBean.star}">
						<f:selectItems value="#{profileManagedBean.starList}"></f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="Rasi :" for="rasi" />

					<p:selectOneMenu id="rasi" value="#{profileManagedBean.rasi}"
						style="width:200px;">
						<f:selectItems value="#{profileManagedBean.rasiList}"></f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="About Self :" for="aboutSelf" />
					<p:inputTextarea value="#{profileManagedBean.star}" id="aboutSelf" />
					<p:outputLabel value="Occupation :" for="occupation" />
					<p:inputText value="#{profileManagedBean.occupation}"
						id="occupation" />
					<p:outputLabel value="Income :" for="income" />

					<p:selectOneMenu value="#{profileManagedBean.income}" id="income">
						<f:selectItems value="#{profileManagedBean.incomeList}"></f:selectItems>
					</p:selectOneMenu>
					<p:outputLabel value="Father Name :" for="fathername" />
					<p:inputText value="#{profileManagedBean.fathername}"
						id="fathername" />
					<p:outputLabel value="Father Profession :" for="fatherprofession" />
					<p:inputText value="#{profileManagedBean.fatherprofession}"
						id="fatherprofession" />
					<p:outputLabel value="Mother Name :" for="mothername" />
					<p:inputText value="#{profileManagedBean.mothername}"
						id="mothername" />
					<p:outputLabel value="Mother Profession :" for="motherprofession" />
					<p:inputText value="#{profileManagedBean.motherprofession}"
						id="motherprofession" />

					<p:outputLabel value="Email :" for="email" />
					<p:inputText value="#{profileManagedBean.email}" id="email" />
					<p:outputLabel value="Mobile no :" for="mobileno" />
					<p:inputText value="#{profileManagedBean.mobileno}" id="mobileno" />
					<p:outputLabel value="address :" for="address" />
					<p:inputTextarea value="#{profileManagedBean.address}" id="address" />
					<p:outputLabel value="url :" for="url" />
					<p:inputText value="#{profileManagedBean.url}" id="url" />
					<p:outputLabel value="video Url :" for="videoUrl" />
					<p:inputText value="#{profileManagedBean.videoUrl}" id="videoUrl" />
					<p:spacer />
					<p:spacer />
					<p:spacer />
					<h:panelGrid columns="2">
						<p:commandButton value="Update" id="add" update=":search:growl"
							action="#{profileManagedBean.editProfile}"
							style="margin-right:20px;" styleClass="ui-priority-primary" />
						<p:commandButton value="Clear" id="clear" update="details"
							action="#{profileManagedBean.reset}" immediate="true"
							process="@this" style="margin-right:20px;"
							styleClass="ui-priority-primary" />
					</h:panelGrid>

				</h:panelGrid>
			</p:fieldset>

		</h:form>
	</ui:define>

</ui:composition>
